import { inject } from 'vue';
import { useStore } from 'vuex';
import { useRoute, useRouter, RouteLocationNormalizedLoaded, Router } from 'vue-router';

let http: any;
let message: any;
let store: any = null;
let route: RouteLocationNormalizedLoaded;
let router: Router;

export function getHttp() {
  return http || (http = inject('$http'));
}

export function getMessage() {
  return message || (message = inject('$message'));
}

export function getStore() {
  return store || (store = useStore());
}

export function getRoute() {
  return route || (route = useRoute());
}

export function getRouter() {
  return router || (router = useRouter());
}
